/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Sistema_Experto_Diagnostico.java
 *
 * Created on 31/03/2011, 07:02:17 PM
 */

package sediagnosticarhepatitis;

import javax.swing.JOptionPane;

/**
 *
 * @author ALENIN
 */
public class Sistema_Experto_Diagnostico extends javax.swing.JFrame {

    /** Creates new form Sistema_Experto_Diagnostico */
    public boolean SintomasHepatitisA(){
        boolean b = false;
         if (jrbcansancio.isSelected()==true && jrbcansancio.getText().equals("Cansancio")){
            if (jrbmalestarestomacal.isSelected()==true && jrbmalestarestomacal.getText().equals("Malestar Estomacal")){
                 if (jrbperdidaapetito.isSelected()==true && jrbperdidaapetito.getText().equals("Pérdida de Apetito")){
                     if (jrbfiebre.isSelected()==true && jrbfiebre.getText().equals("Fiebre")){
//                                     jtfdiagnostico.setText("ADOLECE HEPATITIS A");
//                                     jtatratamiento.setText("Tomar Penicilina");
                                     b=true;
                     }
                 }
            }
//        }else{
//             jtfdiagnostico.setText("NO ADOLECE HEPATITIS");
//             jtatratamiento.setText("Consulte inmediatamente al médico");
        }
        return b;
    }

    public boolean SintomasHepatitisA2(){
        boolean b2 = false;
         if (jrbhecesclaras.isSelected()==true && jrbhecesclaras.getText().equals("Heces Claras")){
            if (jrborinaturbiayamarilla.isSelected()==true && jrborinaturbiayamarilla.getText().equals("Orina turbia y amarillenta")){
                 if (jrbdiarrea.isSelected()==true && jrbdiarrea.getText().equals("Diarrea")){
                     if (jrbcolorojosypielamarillos.isSelected()==true && jrbcolorojosypielamarillos.getText().equals("Color amarillento de Ojos y Piel")){
                                     b2=true;
                     }
                 }
            }
//        }else{
//             jtfdiagnostico.setText("NO ADOLECE HEPATITIS");
//             jtfdiagnostico.setEditable(false);
//             jtatratamiento.setText("Consulte inmediatamente al médico");
//             jtatratamiento.setEditable(false);
        }
        return b2;
    }

    public Sistema_Experto_Diagnostico() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel2 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jtatratamiento = new javax.swing.JTextArea();
        btndiagnostico = new javax.swing.JButton();
        btnnuevo = new javax.swing.JButton();
        btnsalir = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jtfdiagnostico = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jrbcansancio = new javax.swing.JRadioButton();
        jrbmalestarestomacal = new javax.swing.JRadioButton();
        jrbperdidaapetito = new javax.swing.JRadioButton();
        jrbfiebre = new javax.swing.JRadioButton();
        jrbhecesclaras = new javax.swing.JRadioButton();
        jrborinaturbiayamarilla = new javax.swing.JRadioButton();
        jrbdiarrea = new javax.swing.JRadioButton();
        jrbcolorojosypielamarillos = new javax.swing.JRadioButton();
        jrbmoretonesencuierpo = new javax.swing.JRadioButton();
        jrbhinchazonestomagootobillo = new javax.swing.JRadioButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setBackground(new java.awt.Color(255, 153, 51));

        jPanel2.setBackground(new java.awt.Color(204, 51, 0));

        jLabel1.setBackground(new java.awt.Color(204, 0, 0));
        jLabel1.setFont(new java.awt.Font("Virtual DJ", 3, 14));
        jLabel1.setText("DIAGNOSTICAR HEPATITIS A y B");

        jPanel1.setBackground(new java.awt.Color(255, 255, 153));
        jPanel1.setBorder(new javax.swing.border.MatteBorder(null));
        jPanel1.setForeground(new java.awt.Color(255, 255, 153));

        jtatratamiento.setColumns(20);
        jtatratamiento.setRows(5);
        jScrollPane1.setViewportView(jtatratamiento);

        btndiagnostico.setBackground(new java.awt.Color(255, 255, 102));
        btndiagnostico.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sediagnosticarhepatitis/diagnosticar.jpg"))); // NOI18N
        btndiagnostico.setText("Diagnóstico");
        btndiagnostico.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btndiagnosticoActionPerformed(evt);
            }
        });

        btnnuevo.setBackground(new java.awt.Color(255, 255, 102));
        btnnuevo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sediagnosticarhepatitis/nuevo.jpg"))); // NOI18N
        btnnuevo.setText("Nuevo");
        btnnuevo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnnuevoActionPerformed(evt);
            }
        });

        btnsalir.setBackground(new java.awt.Color(255, 255, 102));
        btnsalir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sediagnosticarhepatitis/salir.jpg"))); // NOI18N
        btnsalir.setText("Salir");
        btnsalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnsalirActionPerformed(evt);
            }
        });

        jLabel3.setBackground(new java.awt.Color(153, 153, 0));
        jLabel3.setFont(new java.awt.Font("Kristen ITC", 3, 11));
        jLabel3.setText("Tratamiento");

        jButton1.setBackground(new java.awt.Color(255, 255, 102));
        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sediagnosticarhepatitis/imprimir.jpg"))); // NOI18N
        jButton1.setText("Imprimir");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jLabel2.setBackground(new java.awt.Color(204, 51, 0));
        jLabel2.setFont(new java.awt.Font("Perpetua Titling MT", 3, 11));
        jLabel2.setText("Sintomas de la Hepatitis");

        jPanel3.setBackground(new java.awt.Color(255, 102, 51));

        jrbcansancio.setBackground(new java.awt.Color(255, 102, 51));
        jrbcansancio.setText("Cansancio");

        jrbmalestarestomacal.setBackground(new java.awt.Color(255, 102, 51));
        jrbmalestarestomacal.setText("Malestar Estomacal");

        jrbperdidaapetito.setBackground(new java.awt.Color(255, 102, 51));
        jrbperdidaapetito.setText("Pérdida de Apetito");

        jrbfiebre.setBackground(new java.awt.Color(255, 102, 51));
        jrbfiebre.setText("Fiebre");

        jrbhecesclaras.setBackground(new java.awt.Color(255, 102, 51));
        jrbhecesclaras.setText("Heces Claras");

        jrborinaturbiayamarilla.setBackground(new java.awt.Color(255, 102, 51));
        jrborinaturbiayamarilla.setText("Orina turbia y amarillenta");

        jrbdiarrea.setBackground(new java.awt.Color(255, 102, 51));
        jrbdiarrea.setText("Diarrea");

        jrbcolorojosypielamarillos.setBackground(new java.awt.Color(255, 102, 51));
        jrbcolorojosypielamarillos.setText("Color amarillento de Ojos y Piel");

        jrbmoretonesencuierpo.setBackground(new java.awt.Color(255, 102, 51));
        jrbmoretonesencuierpo.setText("Moretones en el cuerpo");
        jrbmoretonesencuierpo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbmoretonesencuierpoActionPerformed(evt);
            }
        });

        jrbhinchazonestomagootobillo.setBackground(new java.awt.Color(255, 102, 51));
        jrbhinchazonestomagootobillo.setText("Hinchazón de estómago o tobillos");
        jrbhinchazonestomagootobillo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbhinchazonestomagootobilloActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jrbmalestarestomacal)
                    .addComponent(jrbcansancio)
                    .addComponent(jrbfiebre)
                    .addComponent(jrbperdidaapetito)
                    .addComponent(jrbhecesclaras))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 27, Short.MAX_VALUE)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jrborinaturbiayamarilla)
                    .addComponent(jrbhinchazonestomagootobillo)
                    .addComponent(jrbmoretonesencuierpo)
                    .addComponent(jrbcolorojosypielamarillos)
                    .addComponent(jrbdiarrea))
                .addGap(15, 15, 15))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jrborinaturbiayamarilla)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrbdiarrea)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrbcolorojosypielamarillos)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrbmoretonesencuierpo)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrbhinchazonestomagootobillo))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jrbcansancio)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrbmalestarestomacal)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrbperdidaapetito)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrbfiebre)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrbhecesclaras)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addContainerGap(186, Short.MAX_VALUE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addContainerGap(276, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                .addGap(12, 12, 12)
                                .addComponent(btnnuevo)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnsalir, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jButton1))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                .addComponent(btndiagnostico, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtfdiagnostico, javax.swing.GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE)))
                        .addContainerGap())))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel2)
                .addGap(18, 18, 18)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(31, 31, 31)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnsalir)
                    .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnnuevo))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btndiagnostico, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtfdiagnostico, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(26, 26, 26)
                .addComponent(jLabel3)
                .addGap(11, 11, 11)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(23, 23, 23))
        );

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addContainerGap(20, Short.MAX_VALUE))
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE)
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jrbmoretonesencuierpoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbmoretonesencuierpoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jrbmoretonesencuierpoActionPerformed

    private void jrbhinchazonestomagootobilloActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbhinchazonestomagootobilloActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jrbhinchazonestomagootobilloActionPerformed

    private void btnnuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnnuevoActionPerformed
        // TODO add your handling code here:
        jrbcansancio.setSelected(false);
        jrbmalestarestomacal.setSelected(false);
        jrbperdidaapetito.setSelected(false);
        jrbfiebre.setSelected(false);
        jrbhecesclaras.setSelected(false);
        jrborinaturbiayamarilla.setSelected(false);
        jrbdiarrea.setSelected(false);
        jrbcolorojosypielamarillos.setSelected(false);
        jrbmoretonesencuierpo.setSelected(false);
        jrbhinchazonestomagootobillo.setSelected(false);
        jtfdiagnostico.setText("");
        jtatratamiento.setText("");
    }//GEN-LAST:event_btnnuevoActionPerformed

    private void btnsalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnsalirActionPerformed
        // TODO add your handling code here:
        System.exit(0);
    }//GEN-LAST:event_btnsalirActionPerformed

    private void btndiagnosticoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btndiagnosticoActionPerformed
        // TODO add your handling code here:
//           JOptionPane.showMessageDialog(null, "Seleccione un sistona o sintomas");
             if (SintomasHepatitisA()==true || SintomasHepatitisA2()==true){
                jtfdiagnostico.setText("ADOLECE HEPATITIS A");
                jtfdiagnostico.setEditable(false);
                jtatratamiento.setText("Administrar a personas mayores de 12 meses una vacuna VAQTA en los musculos del hombro una vez al mes en el transcurso de 6 a 18 meses");
                jtatratamiento.setEditable(false);
                if ((SintomasHepatitisA() == true || SintomasHepatitisA2() == true) && (jrbmoretonesencuierpo.isSelected() == true || jrbhinchazonestomagootobillo.isSelected() == true)) {
                    jtfdiagnostico.setText("ADOLECE HEPATITIS B");
                    jtatratamiento.setText("Administrar via oral Telbivudina una vez al día bajo investigación médica durante 3 meses");
                    jtfdiagnostico.setEditable(false);
                    jtatratamiento.setEditable(false);
//                }else
//                    jtfdiagnostico.setText("ADOLECE HEPATITIS A");
//                    jtfdiagnostico.setEditable(false);
//                    jtatratamiento.setText("Administrar a personas mayores de 12 meses una vacuna VAQTA en los musculos del hombro una vez al mes en el transcurso de 6 a 18 meses");
//                    jtatratamiento.setEditable(false);
             }}else{
                 jtfdiagnostico.setText("NO ADOLECE HEPATITIS");
                 jtfdiagnostico.setEditable(false);
                 jtatratamiento.setText("Por favor consulte inmediatamente al médico Puede tener otra enfermedad");
                 jtatratamiento.setEditable(false);
        }
    }//GEN-LAST:event_btndiagnosticoActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
        Imprimir i = new Imprimir(jtfdiagnostico.getText(), jtatratamiento.getText());
        i.imprimir();
    }//GEN-LAST:event_jButton1ActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Sistema_Experto_Diagnostico().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btndiagnostico;
    private javax.swing.JButton btnnuevo;
    private javax.swing.JButton btnsalir;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JRadioButton jrbcansancio;
    private javax.swing.JRadioButton jrbcolorojosypielamarillos;
    private javax.swing.JRadioButton jrbdiarrea;
    private javax.swing.JRadioButton jrbfiebre;
    private javax.swing.JRadioButton jrbhecesclaras;
    private javax.swing.JRadioButton jrbhinchazonestomagootobillo;
    private javax.swing.JRadioButton jrbmalestarestomacal;
    private javax.swing.JRadioButton jrbmoretonesencuierpo;
    private javax.swing.JRadioButton jrborinaturbiayamarilla;
    private javax.swing.JRadioButton jrbperdidaapetito;
    private javax.swing.JTextArea jtatratamiento;
    private javax.swing.JTextField jtfdiagnostico;
    // End of variables declaration//GEN-END:variables

}
